﻿namespace DeltaGroup.WheelOfJeopardy.Model
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Serialization;

    public class Category
    {
        #region Fields

        private List<Challenge> _challenges;
        private string _title;

        #endregion Fields

        #region Constructors

        // needed for serialization
        /// <summary>
        /// Initializes a new instance of the <see cref="Category"/> class.
        /// </summary>
        public Category()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Category"/> class.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="challenges">The challenges.</param>
        public Category(string title, List<Challenge> challenges)
        {
            _title = title;
            _challenges = challenges;
        }

        #endregion Constructors

        #region Properties

        /// <summary>
        /// Gets or sets the challenges.
        /// </summary>
        /// <value>The challenges.</value>
        [XmlElement(ElementName = "Challenge")]
        public List<Challenge> Challenges
        {
            get { return _challenges; }
            set { _challenges = value; }
        }

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        [XmlAttribute]
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        #endregion Properties

        #region Methods

        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return Title;
        }

        #endregion Methods
    }
}